﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:bindable="clr-namespace:BindableApplicationBar;assembly=BindableApplicationBar"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" x:Class="AllBots.View.LibraryView"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480"
    DataContext="{Binding Library, Source={StaticResource Locator}}">

    <ListBox ItemsSource="{Binding Bots}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Button Content="{Binding Name}" Template="{StaticResource EmptyButtonTemplate}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Command="{Binding Library.ChatWithBotCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}" Foreground="{StaticResource NeutralBrush}" FontWeight="Bold" Margin="0,2">
					<toolkit:ContextMenuService.ContextMenu>
                    	<toolkit:ContextMenu>
                            <toolkit:MenuItem Command="{Binding Library.EditCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}" Header="{Binding AppResources.Edit, Source={StaticResource Localizator}}" />
                        	<toolkit:MenuItem Command="{Binding Library.DeleteCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}" Header="{Binding AppResources.Delete, Source={StaticResource Localizator}}" />
                    	</toolkit:ContextMenu>
                	</toolkit:ContextMenuService.ContextMenu>
				</Button>
            </DataTemplate>
        </ListBox.ItemTemplate>
    	<i:Interaction.Triggers>
    		<ec:DataTrigger Binding="{Binding IdSent}" Value="true">
    			<ec:NavigateToPageAction TargetPage="/ChatPage.xaml"/>
    		</ec:DataTrigger>
    	</i:Interaction.Triggers>
    </ListBox>
</UserControl>
